<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="t" uri="http://training.linesno.com/jsp/jstl/training"%>

<!--
@desc  添加
@author LuoAnDong
@since 2019-05-03 14:07:38
-->

<t:body>

	<div class="col-md-12 col-lg-12">
		<div class="panel panel-default training-panel-add">
			<div class="panel-body">
				<br/>
				<form class="form-horizontal" name="trainingAddForm">

<t:input label="模板空间名称" name="namespace" />
<t:input label="模板空间排序" name="namespaceSort" />

					<t:submit label="提交" />

				</form>
			</div>
		</div>
	</div>

<script tpe="text/javascript">

	//用name绑定需要验证的元素
	tt.vf.req.add(
"namespace" ,
"namespaceSort" 
	);

	var layerLoading ;
	var option = {
		url : '${ctx}handle/base/print/namespace/save.do',
		type : 'POST',
		success : function(data) {
			layer.close(layerLoading);
			if(data.status != 200){
				top.layer.msg(data.desc) ;
			}else if(data.status == 200){
				top.layer.msg("添加成功.") ;
				$("form[name=trainingAddForm]")[0].reset() ;
				top.refreshJqgrid() ;
			}
		},
		dataType : "json",
		timeout : 30000 // 超时时间设置为30秒
	}

	function trainingSubmit() {
		console.log("trainingSubmit") ;
		if (tt.validateForm('trainingAddForm')) { //addForm是form的name
			layerLoading = layer.load() ;
			$("form[name=trainingAddForm]").ajaxSubmit(option);
		}
	}
</script>

</t:body>

